package com.uraurora.crescent.function;

import java.util.Objects;

@FunctionalInterface
public interface Action1<T> {

    void on(T t);

    default Action1<T> before(Action1<? super T> before) {
        Objects.requireNonNull(before);
        return t -> { before.on(t); on(t); };
    }

    default Action1<T> after(Action1<? super T> after) {
        Objects.requireNonNull(after);
        return t -> { on(t); after.on(t); };
    }
}
